package com.laolang.gongda.bookshop.utils;

import org.springframework.core.convert.converter.Converter;

import com.laolang.gongda.bookshop.enums.SexEnum;

public class StringToENewsConverter implements Converter<String, SexEnum> {

	@Override
	public SexEnum convert(String source) {
		String value = source.trim();
		if ("".equals(value)) {
			return null;
		} else if ("MAIL".equals(value)) {
			return SexEnum.MAIL;
		} else if ("FAMAIL".equals(value)) {
			return SexEnum.FAMAIL;
		}
		return null;

	}
}
